#include <bits/stdc++.h>

using namespace std;
struct plan
{
    int t;
    int last_time;
};
int lowerBound(plan p[],int left,int right,int v)
{
    int mid;
    while (left<right)
    {
        mid=left+(right-left)/2;
        if (p[mid].t>=v)
        {
            right=mid;
        }
        else
        {
            left=mid+1;
        }
    }
    return left;
}
int main_53_1()
{
    int n,m,k,ti,ci,qm;
    scanf("%d%d%d",&n,&m,&k);
    plan t_plans[n];
    for (int i=0;i<n ;++i )
    {
        scanf("%d%d",&ti,&ci);
        t_plans[i].t=ti,t_plans[i].last_time=ci;
    }
    int plan_num[m]={0};
    for (int j=0;j<m ;++j )
    {
        scanf("%d",&qm);
        int pos=lowerBound(t_plans,0,n,qm+k);
        for (int l=pos;l<n ;++l )
        {
            if ((t_plans[l].t-(qm+k))<t_plans[l].last_time)
            {
                ++plan_num[j];
            }
        }
    }
    for (int j=0;j<m ;++j )
    {
        printf("%d\n",plan_num[j]);
    }
    return 0;
}
